home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8348 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com(Pete)
  3. Newsgroups: comp.lang.c++
  4. Subject: Class vs. Struct - was Re: No struct in C++!!?
  5. Date: 17 Feb 1996 00:15:10 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4g36me$abk@news1.usa.pipeline.com>
  8. References: <31235E0C.252C@idi.oclc.org>
  9. NNTP-Posting-Host: pipe13.h1.usa.pipeline.com
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete)
  13. X-Newsreader: Pipeline USA v3.3.0
  14.  
  15. On Feb 15, 1996 08:23:40 in article <Re: No struct in C++!!?>, 'Ron
  16. Unterreiner <runterreiner@idi.oclc.org>' wrote: 
  17.  
  18. >A class is a struct.  Anywhere you see the word struct you can substitute 
  19.  
  20. >the word class.  The major thing a class gives you that a C struct  
  21. >doesn't is the ability to protect data.  You can control the way the data 
  22.  
  23. >in the class is accessed from outside by writing methods.  It works much  
  24. >like stacks and queues where you would define AddMember, DeleteMember and 
  25.  
  26. >TraverseMember functions.  In a nutshell, a class is a really powerful  
  27. >struct.  You can define a class like a C struct though by making all your 
  28.  
  29. >data public.  This is usually a bad idea because the data in the class  
  30. >could get stepped on accidently if you are not careful.  The whole  
  31. >purpose of classes is to restrict access to the data inside. 
  32.  
  33. Actually there's a lot more to classes than protecting data.  
  34. Read any OO book for for info. 
  35.  
  36. -- 
  37. Pete Grant 
  38. Kalevi, Inc. 
  39. Software Engineering & development
  40.